﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Data.Objects.DataClasses;
using System.Xml.Serialization;

namespace FinalProject.DAL.Model
{

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName = "InvoiceModel", Name = "Item")]
    [Serializable()]
    [DataContractAttribute(IsReference = true)]
    public partial class Item : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Item object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="name">Initial value of the Name property.</param>
        /// <param name="lotNumber">Initial value of the LotNumber property.</param>
        /// <param name="description">Initial value of the Description property.</param>
        /// <param name="warehouseId">Initial value of the WarehouseId property.</param>
        public static Item CreateItem(global::System.Guid id, global::System.String name, global::System.String lotNumber, global::System.String description, global::System.Guid warehouseId)
        {
            Item item = new Item();
            item.Id = id;
            item.Name = name;
            item.LotNumber = lotNumber;
            item.Description = description;
            item.WarehouseId = warehouseId;
            return item;
        }

        #endregion

        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = true, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Guid Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Guid _Id;
        partial void OnIdChanging(global::System.Guid value);
        partial void OnIdChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.String Name
        {
            get
            {
                return _Name;
            }
            set
            {
                OnNameChanging(value);
                ReportPropertyChanging("Name");
                _Name = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Name");
                OnNameChanged();
            }
        }
        private global::System.String _Name;
        partial void OnNameChanging(global::System.String value);
        partial void OnNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.String LotNumber
        {
            get
            {
                return _LotNumber;
            }
            set
            {
                OnLotNumberChanging(value);
                ReportPropertyChanging("LotNumber");
                _LotNumber = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LotNumber");
                OnLotNumberChanged();
            }
        }

        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public long StockNumber
        {
            get;
            set;
        }

        private global::System.String _LotNumber;
        partial void OnLotNumberChanging(global::System.String value);
        partial void OnLotNumberChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Guid WarehouseId
        {
            get
            {
                return _WarehouseId;
            }
            set
            {
                OnWarehouseIdChanging(value);
                ReportPropertyChanging("WarehouseId");
                _WarehouseId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("WarehouseId");
                OnWarehouseIdChanged();
            }
        }
        private global::System.Guid _WarehouseId;
        partial void OnWarehouseIdChanging(global::System.Guid value);
        partial void OnWarehouseIdChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Decimal Price
        {
            get
            {
                return _Price;
            }
            set
            {
                OnPriceChanging(value);
                ReportPropertyChanging("Description");
                _Price = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.Decimal _Price;
        partial void OnPriceChanging(global::System.Decimal value);
        partial void OnPriceChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "ItemDocumentRow", "DocumentRow")]
        public EntityCollection<DocumentRow> DocumentRows
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<DocumentRow>("InvoiceModel.ItemDocumentRow", "DocumentRow");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<DocumentRow>("InvoiceModel.ItemDocumentRow", "DocumentRow", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "WarehouseItem", "Warehouse")]
        public Warehouse Warehouse
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Warehouse>("InvoiceModel.WarehouseItem", "Warehouse").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Warehouse>("InvoiceModel.WarehouseItem", "Warehouse").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Warehouse> WarehouseReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Warehouse>("InvoiceModel.WarehouseItem", "Warehouse");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Warehouse>("InvoiceModel.WarehouseItem", "Warehouse", value);
                }
            }
        }

        #endregion
    }

}
